<!-- 
说明：会员表列表
作者：nwl
日期：2018-10-11 14:15:0
版本：1.0.0
-->
<template>
  <div>
    <mk-search-box>

      <el-row>

        <el-col :span="5">
          <label>客户名称:</label>
          <el-input v-model="ui.searchData.mname"
                    size="small"></el-input>
        </el-col>

        <el-col :span="5">
          <label>联系电话:</label>
          <el-input v-model="ui.searchData.conphone"
                    size="small"></el-input>
        </el-col>
        <el-col :span="5">
          <label>推荐号码:</label>
          <el-input v-model="ui.searchData.refcode"
                    size="small"></el-input>
        </el-col>
        <el-col :span="5">
          <label>客户类型:</label>
          <mk-config-select mk-config="Z_MEM_LX"
                            v-model="ui.searchData.type"
                            size="small"
                            mkEmptyLabel="请选择"></mk-config-select>
        </el-col>
      </el-row>
      <el-row>

        <el-col :span="5">
          <label>客户状态:</label>

          <mk-config-select mk-config="Z_MEM_STATE"
                            v-model="ui.searchData.status"
                            size="small"
                            mkEmptyLabel="请选择"></mk-config-select>
        </el-col>

        <mk-search-buttons v-model="ui.searching" />
      </el-row>

    </mk-search-box>
    <el-row>
      <add @reload="doSearch" />
    </el-row>
    <mk-table v-model="ui"
              mk-multiple
              mk-index
              mk-sql-code="zMembers.select_list"
              mk-table-id="z-members.list.common"
              ref="table">
      <el-table-column align="left"
                       prop="type"
                       label="客户类型"
                       width="70">
        <template slot-scope="memberslx">
          {{memberslx.row.type | data-config('Z_MEM_LX')}}
        </template>

      </el-table-column>
      <el-table-column align="left"
                       prop="huizhangshengfen"
                       label="会长省份"
                       width="140" />
      <el-table-column align="left"
                       prop="mname"
                       label="用户名"
                       width="100" />
      <el-table-column align="left"
                       prop="phone"
                       label="手机号"
                       width="100" />

      <el-table-column align="left"
                       prop="contacts"
                       label="开户人"
                       width="80" />
      <el-table-column align="left"
                       prop="conphone"
                       label="开户手机号"
                       width="100" />
      <el-table-column align="left"
                       prop="address"
                       label="详细地址"
                       width="230">
        <template slot-scope="membersaddress">
          {{membersaddress.row.provincename}}{{membersaddress.row.cityname}}{{membersaddress.row.areaname}}{{membersaddress.row.address}}
        </template>
      </el-table-column>

      <el-table-column align="left"
                       prop="refcode"
                       label="推荐号"
                       width="100" />
      <el-table-column align="left"
                       prop="status"
                       label="状态"
                       width="70">
        <template slot-scope="membersstatus">
          {{membersstatus.row.status | data-config('Z_MEM_STATE')}}
        </template>
      </el-table-column>

      <el-table-column prop="doing"
                       align="center"
                       label="操作"
                       width="120">
        <template slot-scope="scope">
          <edit :row="scope.row"
                @reload="doSearch" />
          <shen-he :row="scope.row"
                   @reload="doSearch"
                   v-if="scope.row.status=='0'" />
        </template>
      </el-table-column>
    </mk-table>
  </div>
</template>

<script>
  import {
    MkBase
  } from 'element-ui'
  import Add from './list/add-button'
  import Edit from './list/edit-button'
  import ShenHe from './list/shenhe-button'
  import searchData from './list/search-data'

  export default {
    name: 'z-members-list',
    mixins: [MkBase],
    components: {
      Add,
      Edit,
      ShenHe
    },
    data () {
      return {
        ui: {
          searching: true,
          searchData: searchData()
        }
      }
    },
    methods: {
      /**
       * 刷新本页面
       */
      doSearch () {
        this.ui.searching = true
      }
    }
  }
</script>